﻿using MCMesServer.DBFunctions.TransformFuncs;
using MesBLL.EventService;
using MesDAL.DBInfo;
using MesDAL.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MCMesServer.DBFunctions.DBFuncs
{
    public class MachineStateLogDBFunc
    {
        public async static Task<MachineStateLogDTO> AddNewMachineStateLog(MachineStateLogDTO dto)
        {
            using (var stateSer = new MachineStateLogService())
            {
                machinestate_log statelog = TransformDTOFunc.TransformMachineState2Model(dto);
                machinestate_log afterStatelog = await stateSer.AddAsync(statelog);
                MachineStateLogDTO stateDto = TransformDTOFunc.TransformModel2MachineStateDTO(afterStatelog);
                return stateDto;
            }
        }
    }
}
